home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / LEMACS.4 (.txt) < prev    next >
GNU Info File  |  1994-09-21  |  46KB  |  800 lines

  1. This is Info file ../info/lemacs, produced by Makeinfo-1.55 from the
  2. input file lemacs.txi.
  3.    This file documents the GNU Emacs editor.
  4.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  5. 1991, 1992 Lucid, Inc.
  6.    Permission is granted to make and distribute verbatim copies of this
  7. manual provided the copyright notice and this permission notice are
  8. preserved on all copies.
  9.    Permission is granted to copy and distribute modified versions of
  10. this manual under the conditions for verbatim copying, provided also
  11. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  12. General Public License" are included exactly as in the original, and
  13. provided that the entire resulting derived work is distributed under the
  14. terms of a permission notice identical to this one.
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions, except that the sections entitled "The GNU Manifesto",
  18. "Distribution" and "GNU General Public License" may be included in a
  19. translation approved by the author instead of in the original English.
  20. File: lemacs,  Node: Killing,  Next: Yanking,  Prev: Mark,  Up: Top
  21. Deletion and Killing
  22. ====================
  23.    Most commands which erase text from the buffer save it. You can get
  24. the text back if you change your mind, or you can move or copy it to
  25. other parts of the buffer.  Commands which erase text and save it in the
  26. kill ring are known as "kill" commands.  Some other commands erase text
  27. but do not save it; they are known as "delete" commands.  (This
  28. distinction is made only for erasing text in the buffer.)
  29.    The commands' names and individual descriptions use the words `kill'
  30. and `delete' to indicate what they do.  If you perform a kill or delete
  31. command by mistake, use the `C-x u' (`undo') command to undo it (*note
  32. Undo::.). The delete commands include `C-d' (`delete-char') and DEL
  33. (`delete-backward-char'), which delete only one character at a time,
  34. and those commands that delete only spaces or newlines.  Commands that
  35. can destroy significant amounts of nontrivial data usually kill.
  36. Deletion
  37. --------
  38. `C-d'
  39.      Delete next character (`delete-char').
  40. `DEL'
  41.      Delete previous character (`delete-backward-char').
  42. `M-\'
  43.      Delete spaces and tabs around point (`delete-horizontal-space').
  44. `M-SPC'
  45.      Delete spaces and tabs around point, leaving one space
  46.      (`just-one-space').
  47. `C-x C-o'
  48.      Delete blank lines around the current line (`delete-blank-lines').
  49. `M-^'
  50.      Join two lines by deleting the intervening newline, and any
  51.      indentation following it (`delete-indentation').
  52.    The most basic delete commands are `C-d' (`delete-char') and DEL
  53. (`delete-backward-char').  `C-d' deletes the character after point, the
  54. one the cursor is "on top of".  Point doesn't move.  DEL deletes the
  55. character before the cursor, and moves point back.  You can delete
  56. newlines like any other characters in the buffer; deleting a newline
  57. joins two lines.  Actually, `C-d' and DEL aren't always delete
  58. commands; if you give them an argument, they kill instead, since they
  59. can erase more than one character this way.
  60.    The other delete commands delete only formatting characters: spaces,
  61. tabs and newlines.  `M-\' (`delete-horizontal-space') deletes all
  62. spaces and tab characters before and after point.  `M-SPC'
  63. (`just-one-space') does the same but leaves a single space after point,
  64. regardless of the number of spaces that existed previously (even zero).
  65.    `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
  66. current line. If the current line is blank, it deletes all blank lines
  67. preceding the current line as well as leaving one blank line, the
  68. current line.  `M-^' (`delete-indentation') joins the current line and
  69. the previous line, or the current line and the next line if given an
  70. argument, by deleting a newline and all surrounding spaces, possibly
  71. leaving a single space.  *Note M-^: Indentation.
  72. Killing by Lines
  73. ----------------
  74. `C-k'
  75.      Kill rest of line or one or more lines (`kill-line').
  76.    The simplest kill command is `C-k'.  If given at the beginning of a
  77. line, it kills all the text on the line, leaving the line blank.  If
  78. given on a blank line, the blank line disappears.  As a consequence, a
  79. line disappears completely if you go to the front of a non-blank line
  80. and type `C-k' twice.
  81.    More generally, `C-k' kills from point up to the end of the line,
  82. unless it is at the end of a line.  In that case, it kills the newline
  83. following the line, thus merging the next line into the current one.
  84. Emacs ignores invisible spaces and tabs at the end of the line when
  85. deciding which case applies: if point appears to be at the end of the
  86. line, you can be sure the newline will be killed.
  87.    If you give `C-k' a positive argument, it kills that many lines and
  88. the newlines that follow them (however, text on the current line before
  89. point is not killed).  With a negative argument, `C-k' kills back to a
  90. number of line beginnings.  An argument of -2 means kill back to the
  91. second line beginning.  If point is at the beginning of a line, that
  92. line beginning doesn't count, so `C-u - 2 C-k' with point at the front
  93. of a line kills the two previous lines.
  94.    `C-k' with an argument of zero kills all the text before point on the
  95. current line.
  96. Other Kill Commands
  97. -------------------
  98. `C-w'
  99.      Kill region (from point to the mark) (`kill-region').  *Note
  100.      Words::.
  101. `M-d'
  102.      Kill word (`kill-word').
  103. `M-DEL'
  104.      Kill word backwards (`backward-kill-word').
  105. `C-x DEL'
  106.      Kill back to beginning of sentence (`backward-kill-sentence').
  107.      *Note Sentences::.
  108. `M-k'
  109.      Kill to end of sentence (`kill-sentence').
  110. `C-M-k'
  111.      Kill sexp (`kill-sexp').  *Note Lists::.
  112. `M-z CHAR'
  113.      Kill up to next occurrence of CHAR (`zap-to-char').
  114.    `C-w' (`kill-region') is a very general kill command; it kills
  115. everything between point and the mark. You can use this command to kill
  116. any contiguous sequence of characters by first setting the mark at one
  117. end of a sequence of characters, then going to the other end and typing
  118. `C-w'.
  119.    A convenient way of killing is combined with searching: `M-z'
  120. (`zap-to-char') reads a character and kills from point up to (but not
  121. including) the next occurrence of that character in the buffer.  If
  122. there is no next occurrence, killing goes to the end of the buffer.  A
  123. numeric argument acts as a repeat count.  A negative argument means to
  124. search backward and kill text before point.
  125.    Other syntactic units can be killed: words, with `M-DEL' and `M-d'
  126. (*note Words::.); sexps, with `C-M-k' (*note Lists::.); and sentences,
  127. with `C-x DEL' and `M-k' (*note Sentences::.).
  128. File: lemacs,  Node: Yanking,  Next: Using X Selections,  Prev: Killing,  Up: Top
  129. Yanking
  130. =======
  131.    "Yanking" means getting back text which was killed. Some systems
  132. call this "pasting".  The usual way to move or copy text is to kill it
  133. and then yank it one or more times.
  134. `C-y'
  135.      Yank last killed text (`yank').
  136. `M-y'
  137.      Replace re-inserted killed text with the previously killed text
  138.      (`yank-pop').
  139. `M-w'
  140.      Save region as last killed text without actually killing it
  141.      (`copy-region-as-kill').
  142. `C-M-w'
  143.      Append next kill to last batch of killed text (`append-next-kill').
  144. * Menu:
  145. * Kill Ring::       Where killed text is stored.  Basic yanking.
  146. * Appending Kills:: Several kills in a row all yank together.
  147. * Earlier Kills::   Yanking something killed some time ago.
  148. File: lemacs,  Node: Kill Ring,  Next: Appending Kills,  Prev: Yanking,  Up: Yanking
  149. The Kill Ring
  150. -------------
  151.    All killed text is recorded in the "kill ring", a list of blocks of
  152. text that have been killed.  There is only one kill ring, used in all
  153. buffers, so you can kill text in one buffer and yank it in another
  154. buffer.  This is the usual way to move text from one file to another.
  155. (*Note Accumulating Text::, for some other ways.)
  156.    If you have two separate Emacs processes, you cannot use the kill
  157. ring to move text. If you are using Lucid GNU Emacs under X, you can,
  158. however, use the X selection mechanism to move text from one to another.
  159.    If you are using Lucid GNU Emacs under X and have one Emacs process
  160. with multiple screens, they do share the same kill ring.  You can kill
  161. or copy text in one Emacs screen, then yank it in the other screen
  162. belonging to the same process.
  163.    The command `C-y' (`yank') reinserts the text of the most recent
  164. kill.  It leaves the cursor at the end of the text and sets the mark at
  165. the beginning of the text.  *Note Mark::.
  166.    `C-u C-y' yanks the text, leaves the cursor in front of the text,
  167. and sets the mark after it, if the argument is with just a `C-u'.  Any
  168. other argument, including `C-u' and digits, has different results,
  169. described below, under "Yanking Earlier Kills".
  170.    To copy a block of text, you can also use `M-w'
  171. (`copy-region-as-kill'), which copies the region into the kill ring
  172. without removing it from the buffer. `M-w' is similar to `C-w' followed
  173. by `C-y' but does not mark the buffer as "modified" and does not
  174. actually cut anything.
  175. File: lemacs,  Node: Appending Kills,  Next: Earlier Kills,  Prev: Kill Ring,  Up: Yanking
  176. Appending Kills
  177. ---------------
  178.    Normally, each kill command pushes a new block onto the kill ring.
  179. However, two or more kill commands in a row combine their text into a
  180. single entry, so that a single `C-y' yanks it all back. This means you
  181. don't have to kill all the text you want to yank in one command; you
  182. can kill line after line, or word after word, until you have killed what
  183. you want, then get it all back at once using `C-y'. (Thus we join
  184. television in leading people to kill thoughtlessly.)
  185.    Commands that kill forward from point add onto the end of the
  186. previous killed text.  Commands that kill backward from point add onto
  187. the beginning.  This way, any sequence of mixed forward and backward
  188. kill commands puts all the killed text into one entry without
  189. rearrangement.  Numeric arguments do not break the sequence of
  190. appending kills.  For example, suppose the buffer contains
  191.      This is the first
  192.      line of sample text
  193.      and here is the third.
  194. with point at the beginning of the second line.  If you type `C-k C-u 2
  195. M-DEL C-k', the first `C-k' kills the text `line of sample text', `C-u
  196. 2 M-DEL' kills `the first' with the newline that followed it, and the
  197. second `C-k' kills the newline after the second line.  The result is
  198. that the buffer contains `This is and here is the third.' and a single
  199. kill entry contains `the firstRETline of sample textRET'--all the
  200. killed text, in its original order.
  201.    If a kill command is separated from the last kill command by other
  202. commands (not just numeric arguments), it starts a new entry on the kill
  203. ring.  To force a kill command to append, first type the command `C-M-w'
  204. (`append-next-kill'). `C-M-w' tells the following command, if it is a
  205. kill command, to append the text it kills to the last killed text,
  206. instead of starting a new entry.  With `C-M-w', you can kill several
  207. separated pieces of text and accumulate them to be yanked back in one
  208. place.
  209. File: lemacs,  Node: Earlier Kills,  Prev: Appending Kills,  Up: Yanking
  210. Yanking Earlier Kills
  211. ---------------------
  212.    To recover killed text that is no longer the most recent kill, you
  213. need the `Meta-y' (`yank-pop') command.  You can use `M-y' only after a
  214. `C-y' or another `M-y'.  It takes the text previously yanked and
  215. replaces it with the text from an earlier kill.  To recover the text of
  216. the next-to-the-last kill, first use `C-y' to recover the last kill,
  217. then `M-y' to replace it with the previous kill.
  218.    You can think in terms of a "last yank" pointer which points at an
  219. item in the kill ring.  Each time you kill, the "last yank" pointer
  220. moves to the new item at the front of the ring.  `C-y' yanks the item
  221. which the "last yank" pointer points to.  `M-y' moves the "last yank"
  222. pointer to a different item, and the text in the buffer changes to
  223. match.  Enough `M-y' commands can move the pointer to any item in the
  224. ring, so you can get any item into the buffer.  Eventually the pointer
  225. reaches the end of the ring; the next `M-y' moves it to the first item
  226. again.
  227.    Yanking moves the "last yank" pointer around the ring, but does not
  228. change the order of the entries in the ring, which always runs from the
  229. most recent kill at the front to the oldest one still remembered.
  230.    Use `M-y' with a numeric argument, to tell to advance the "last
  231. yank" pointer by the specified number of items.  A negative argument
  232. moves the pointer toward the front of the ring; from the front of the
  233. ring, it moves to the last entry and starts moving forward from there.
  234.    Once the text you are looking for is brought into the buffer, you can
  235. stop doing `M-y' commands and the text will stay there. Since the text
  236. is just a copy of the kill ring item, editing it in the buffer does not
  237. change what's in the ring.  As long you don`t kill additional text, the
  238. "last yank" pointer remains at the same place in the kill ring:
  239. repeating `C-y' will yank another copy of the same old kill.
  240.    If you know how many `M-y' commands it would take to find the text
  241. you want, you can yank that text in one step using `C-y' with a numeric
  242. argument.  `C-y' with an argument greater than one restores the text
  243. the specified number of entries back in the kill ring.  Thus, `C-u 2
  244. C-y' gets the next to the last block of killed text.  It is equivalent
  245. to `C-y M-y'.  `C-y' with a numeric argument starts counting from the
  246. "last yank" pointer, and sets the "last yank" pointer to the entry that
  247. it yanks.
  248.    The variable `kill-ring-max' controls the length of the kill ring;
  249. no more than that many blocks of killed text are saved.
  250. File: lemacs,  Node: Using X Selections,  Next: Accumulating Text,  Prev: Yanking,  Up: Top
  251. Using X Selections
  252. ==================
  253.    In the X window system, mouse selections provide a simple mechanism
  254. for text transfer between different applications.  In a typical X
  255. application, you can select text by pressing the left mouse button and
  256. dragging the cursor over the text you want to copy. The text becomes the
  257. primary X selection and is highlighted. The highlighted region is also
  258. the Emacs selected region.
  259.    * Since the region is the primary X selection, you can go to a
  260.      different X application and click the middle mouse button: the
  261.      text that you selected in the previous application is pasted into
  262.      the current application.
  263.    * Since the region is the Emacs selected region, you can use all
  264.      region commands (`C-w, M-w' etc.) as well as the options of the
  265.      Edit menu to manipulate the selected text.
  266. * Menu:
  267. * X Clipboard Selection::         Storing the primary selection.
  268. * X Selection Commands::    Other operations on the selection.
  269. * X Cut Buffers::           X cut buffers are available for compatibility.
  270. * Active Regions::          Using zmacs-style highlighting of the
  271.                              selected region.
  272. File: lemacs,  Node: X Clipboard Selection,  Next: X Selection Commands,  Prev: Using X Selections,  Up: Using X Selections
  273. The Clipboard Selection
  274. -----------------------
  275.    There are other kinds of X selection besides the primary selection.
  276. Each time a region of text is added to the kill ring (for example, with
  277. C-k, C-w, or M-w or with a Cut or Copy menu item), that text becomes
  278. the clipboard selection.
  279.    Usually, the clipboard selection is not visible. However, if you run
  280. the `xclipboard' application, the most recently killed text--the value
  281. of the clipboard selection--is displayed in a window.  Any time Emacs
  282. adds text to the kill ring, the `xclipboard' application makes a copy
  283. of it and displays it in its window. The value of the clipboard can
  284. survive the lifetime of the running Emacs process. The `xclipboard' man
  285. page provides more details.
  286.    Warning: If you use the `xclipboard' application, remember that it
  287. maintains a list of all things that have been pasted to the clipboard
  288. (that is, killed in Emacs).  If you don't manually delete elements from
  289. this list by clicking on the Delete button in the `xclipboard' window,
  290. the clipboard will eventually consume a lot of memory.
  291. File: lemacs,  Node: X Selection Commands,  Next: X Cut Buffers,  Prev: X Clipboard Selection,  Up: Using X Selections
  292. Miscellaneous X Selection Commands
  293. ----------------------------------
  294. `M-x x-copy-primary-selection'
  295.      Copy the primary selection to both the kill ring and the Clipboard.
  296. `M-x x-insert-selection'
  297.      Insert the current selection into the buffer at point.
  298. `M-x x-delete-primary-selection'
  299.      Deletes the text in the primary selection without copying it to
  300.      the kill ring or the Clipboard.
  301. `M-x x-kill-primary-selection'
  302.      Deletes the text in the primary selection and copies it to both
  303.      the kill ring and the Clipboard.
  304. `M-x x-mouse-kill'
  305.      Kill the text between point and the mouse and copy it to the
  306.      clipboard and to the cut buffer.
  307. `M-x x-new-screen'
  308.      Create a new Emacs screen (that is, a new X window).
  309. `M-x x-own-secondary-selection'
  310.      Make a secondary X selection of the given argument.
  311. `M-x x-own-selection'
  312.      Make a primary X selection of the given argument.
  313. `M-x x-set-point-and-insert-selection'
  314.      Set point where clicked and insert the primary selection or the
  315.      cut buffer.
  316. File: lemacs,  Node: X Cut Buffers,  Next: Active Regions,  Prev: X Selection Commands,  Up: Using X Selections
  317. X Cut Buffers
  318. -------------
  319.    X cut buffers are a different, older way of transferring text between
  320. applications.  Lucid GNU Emacs supports cut buffers for compatibility
  321. with older programs, even though selections are now the preferred way of
  322. transferring text.
  323.    X has a concept of applications "owning" selections.  When you select
  324. text by clicking and dragging inside an application, the application
  325. tells the X server that it owns the selection.  When another
  326. application asks the X server for the value of the selection, the X
  327. server requests the information from the owner. When you use
  328. selections, the selection data is not actually transferred unless
  329. someone wants it; the act of making a selection doesn't transfer data.
  330. Cut buffers are different: when you "own" a cut buffer, the data is
  331. actually transferred to the X server immediately, and survives the
  332. lifetime of the application.
  333.    Any time a region of text becomes the primary selection in Emacs,
  334. Emacs also copies that text to the cut buffer.  This makes it possible
  335. to copy text from a Lucid GNU Emacs buffer and paste it into an older,
  336. non-selection-based application (such as Emacs 18.)
  337.    Note: Older versions of Emacs could not access the X selections, only
  338. the X cut buffers.
  339. File: lemacs,  Node: Active Regions,  Prev: X Cut Buffers,  Up: Using X Selections
  340. Active Regions
  341. --------------
  342.    By default, both the text you select in an Emacs buffer using the
  343. click-and-drag mechanism and text you select by setting point and the
  344. mark is highlighted. You can use Emacs region commands as well as the
  345. Cut and Copy commands on the highlighted region you selected with the
  346. mouse.
  347.    If you prefer, you can make a distinction between text selected with
  348. the mouse and text selected with point and the mark by setting the
  349. variable `zmacs-regions' to `nil'.  In that case:
  350.    * The text selected with the mouse becomes both the X selection and
  351.      the Emacs selected region. You can use menubar commands as well as
  352.      Emacs region commands on it.
  353.    * The text selected with point and the mark does not highlight. You
  354.      can only use Emacs region commands but not the menu bar items on
  355.      it.
  356.    Active regions originally come from Zmacs, the Lisp Machine editor.
  357. The idea behind them is that commands can only operate on a region when
  358. the region is in an "active" state.  Put simply, you can only operate on
  359. a region that is highlighted.
  360.    The variable `zmacs-regions' checks whether LISPM-style active
  361. regions should be used.  This means that commands that operate on the
  362. region (the area between point and the mark) only work while the region
  363. is in the active state, which is indicated by highlighting.  Most
  364. commands causes the region to not be in the active state; for example,
  365. `C-w' only works immediately after activating the region.
  366.    More specifically:
  367.    * Commands that operate on the region only work if the region is
  368.      active.
  369.    * Only a very small set of commands causes the region to become
  370.      active-- those commands whose semantics are to mark an area, such
  371.      as `mark-defun'.
  372.    * The region is deactivated after each command that is executed,
  373.      except that motion commands do not change whether the region is
  374.      active or not.
  375.    `set-mark-command' (`C-SPC') pushes a mark and activates the region.
  376. Moving the cursor with normal motion commands (`C-n', `C-p', etc) will
  377. cause the region between point and the recently-pushed mark to be
  378. highlighted.  It will remain highlighted until some non-motion comand
  379. is executed.
  380.    `exchange-point-and-mark' (`C-x C-x') activates the region.  So if
  381. you mark a region and execute a command that operates on it, you can
  382. reactivate the same region with `C-x C-x' (or perhaps `C-x C-x C-x
  383. C-x') to operate on it again.
  384.    Generally, commands that push marks as a means of navigation, such as
  385. `beginning-of-buffer' (`M-<') and `end-of-buffer' (`M->'), do not
  386. activate the region.  However, commands that push marks as a means of
  387. marking an area of text, such as `mark-defun' (`M-C-h'), `mark-word'
  388. (`M-@'), and `mark-whole-buffer' (`C-x h'), do activate the region.
  389.    When `zmacs-regions' is `t', there is no distinction between the
  390. primary X selection and the active region selected by point and the
  391. mark.  To see this, set the mark (C-SPC) and move the cursor with any
  392. cursor-motion command: the region between point and mark is
  393. highlighted, and you can watch it grow and shrink as you move the
  394. cursor.
  395.    Any other commands besides cursor-motion commands (such as inserting
  396. or deleting text) will cause the region to no longer be active; it will
  397. no longer be highlighted, and will no longer be the primary selection.
  398. Errors also remove highlighting from a region.
  399.    Commands which require a region (such as `C-w') signal an error if
  400. the region is not active.  Certain commands cause the region to be in
  401. its active state.  The most common ones are `push-mark' (C-SPC) and
  402. `exchange-point-and-mark' (`C-x C-x').
  403.    When `zmacs-regions' is `t', programs can be non-intrusive on the
  404. state of the region by setting the variable `zmacs-region-stays' to a
  405. non-`nil' value.  If you are writing a new emacs command that is
  406. conceptually a "motion" command, and should not interfere with the
  407. current highlightedness of the region, then you may set this variable.
  408. It is reset to `nil' after each user command is executed.
  409.    When `zmacs-regions' is `t', programs can make the region between
  410. point and mark go into the active (highlighted) state by using the
  411. function `zmacs-activate-region'. Only a small number of commands
  412. should ever do this.
  413.    When `zmacs-regions' is `t', programs can deactivate the region
  414. between point and the mark by using `zmacs-deactivate-region'.  Note:
  415. you should not have to call this function; the command loop calls it
  416. when appropriate.
  417. File: lemacs,  Node: Accumulating Text,  Next: Rectangles,  Prev: Using X Selections,  Up: Top
  418. Accumulating Text
  419. =================
  420.    Usually you copy or move text by killing it and yanking it, but
  421. there are other ways that are useful for copying one block of text in
  422. many places, or for copying many scattered blocks of text into one
  423. place.
  424.    If you like, you can accumulate blocks of text from scattered
  425. locations either into a buffer or into a file.  The relevant commands
  426. are described here.  You can also use Emacs registers for storing and
  427. accumulating text.  *Note Registers::.
  428. `C-x a'
  429.      Append region to contents of specified buffer (`append-to-buffer').
  430. `M-x prepend-to-buffer'
  431.      Prepend region to contents of specified buffer.
  432. `M-x copy-to-buffer'
  433.      Copy region into specified buffer, deleting that buffer's old
  434.      contents.
  435. `M-x insert-buffer'
  436.      Insert contents of specified buffer into current buffer at point.
  437. `M-x append-to-file'
  438.      Append region to contents of specified file, at the end.
  439.    To accumulate text into a buffer, use the command `C-x a BUFFERNAME'
  440. (`append-to-buffer'), which inserts a copy of the region into the
  441. buffer BUFFERNAME, at the location of point in that buffer.  If there
  442. is no buffer with the given name, one is created.
  443.    If you append text to a buffer that has been used for editing, the
  444. copied text goes to the place where point is.  Point in that buffer is
  445. left at the end of the copied text, so successive uses of `C-x a'
  446. accumulate the text in the specified buffer in the same order as they
  447. were copied.  Strictly speaking, `C-x a' does not always append to the
  448. text already in the buffer; but if `C-x a' is the only command used to
  449. alter a buffer, it does always append to the existing text because
  450. point is always at the end.
  451.    `M-x prepend-to-buffer' is similar to `C-x a' but point in the other
  452. buffer is left before the copied text, so successive prependings add
  453. text in reverse order.  `M-x copy-to-buffer' is similar except that any
  454. existing text in the other buffer is deleted, so the buffer is left
  455. containing just the text newly copied into it.
  456.    You can retrieve the accumulated text from that buffer with `M-x
  457. insert-buffer', which takes BUFFERNAME as an argument.  It inserts a
  458. copy of the text in buffer BUFFERNAME into the selected buffer.  You
  459. could alternatively select the other buffer for editing, perhaps moving
  460. text from it by killing or with `C-x a'.  *Note Buffers::, for
  461. background information on buffers.
  462.    Instead of accumulating text within Emacs, in a buffer, you can
  463. append text directly into a file with `M-x append-to-file', which takes
  464. FILE-NAME as an argument.  It adds the text of the region to the end of
  465. the specified file.  The file is changed immediately on disk.  This
  466. command is normally used with files that are not being visited in
  467. Emacs.  Using it on a file that Emacs is visiting can produce confusing
  468. results, because the file's text inside Emacs does not change while the
  469. file itself changes.
  470. File: lemacs,  Node: Rectangles,  Next: Registers,  Prev: Accumulating Text,  Up: Top
  471. Rectangles
  472. ==========
  473.    The rectangle commands affect rectangular areas of text: all
  474. characters between a certain pair of columns, in a certain range of
  475. lines.  Commands are provided to kill rectangles, yank killed
  476. rectangles, clear them out, or delete them.  Rectangle commands are
  477. useful with text in multicolumnar formats, like code with comments at
  478. the right, or for changing text into or out of such formats.
  479.    To specify the rectangle a command should work on, put the mark at
  480. one corner and point at the opposite corner.  The specified rectangle is
  481. called the "region-rectangle" because it is controlled about the same
  482. way the region is controlled.  Remember that a given combination of
  483. point and mark values can be interpreted either as specifying a region
  484. or as specifying a rectangle; it is up to the command that uses them to
  485. choose the interpretation.
  486. `M-x delete-rectangle'
  487.      Delete the text of the region-rectangle, moving any following text
  488.      on each line leftward to the left edge of the region-rectangle.
  489. `M-x kill-rectangle'
  490.      Similar, but also save the contents of the region-rectangle as the
  491.      "last killed rectangle".
  492. `M-x yank-rectangle'
  493.      Yank the last killed rectangle with its upper left corner at point.
  494. `M-x open-rectangle'
  495.      Insert blank space to fill the space of the region-rectangle.  The
  496.      previous contents of the region-rectangle are pushed rightward.
  497. `M-x clear-rectangle'
  498.      Clear the region-rectangle by replacing its contents with spaces.
  499.    The rectangle operations fall into two classes: commands deleting and
  500. moving rectangles, and commands for blank rectangles.
  501.    There are two ways to get rid of the text in a rectangle: you can
  502. discard the text (delete it) or save it as the "last killed" rectangle.
  503. The commands for these two ways are `M-x delete-rectangle' and `M-x
  504. kill-rectangle'.  In either case, the portion of each line that falls
  505. inside the rectangle's boundaries is deleted, causing following text
  506. (if any) on the line to move left.
  507.    Note that "killing" a rectangle is not killing in the usual sense;
  508. the rectangle is not stored in the kill ring, but in a special place
  509. that only records the most recently killed rectangle (that is, does not
  510. append to a killed rectangle).  Different yank commands have to be used
  511. and only one rectangle is stored because yanking a rectangle is quite
  512. different from yanking linear text and yank-popping commands are
  513. difficult to make sense of.
  514.    Inserting a rectangle is the opposite of deleting one.  You specify
  515. where to put the upper left corner by putting point there.  The
  516. rectangle's first line is inserted at point, the rectangle's second line
  517. is inserted at a point one line vertically down, and so on.  The number
  518. of lines affected is determined by the height of the saved rectangle.
  519.    To insert the last killed rectangle, type `M-x yank-rectangle'.
  520. This can be used to convert single-column lists into double-column
  521. lists; kill the second half of the list as a rectangle and then yank it
  522. beside the first line of the list.
  523.    There are two commands for working with blank rectangles: `M-x
  524. clear-rectangle' to blank out existing text, and `M-x open-rectangle'
  525. to insert a blank rectangle.  Clearing a rectangle is equivalent to
  526. deleting it and then inserting a blank rectangle of the same size.
  527.    Rectangles can also be copied into and out of registers.  *Note
  528. Rectangle Registers: RegRect.
  529. File: lemacs,  Node: Registers,  Next: Display,  Prev: Rectangles,  Up: Top
  530. Registers
  531. *********
  532.    Emacs "registers" are places in which you can save text or positions
  533. for later use.  Text saved in a register can be copied into the buffer
  534. once or many times; a position saved in a register is used by moving
  535. point to that position.  Rectangles can also be copied into and out of
  536. registers (*note Rectangles::.).
  537.    Each register has a name, which is a single character.  A register
  538. can store either a piece of text or a position or a rectangle, but only
  539. one thing at any given time.  Whatever you store in a register remains
  540. there until you store something else in that register.
  541. * Menu:
  542. * RegPos::    Saving positions in registers.
  543. * RegText::   Saving text in registers.
  544. * RegRect::   Saving rectangles in registers.
  545. `M-x view-register RET R'
  546.      Display a description of what register R contains.
  547.    `M-x view-register' reads a register name as an argument and then
  548. displays the contents of the specified register.
  549. File: lemacs,  Node: RegPos,  Next: RegText,  Prev: Registers,  Up: Registers
  550. Saving Positions in Registers
  551. =============================
  552.    Saving a position records a spot in a buffer so you can move back
  553. there later.  Moving to a saved position re-selects the buffer and
  554. moves point to the spot.
  555. `C-x / R'
  556.      Save the location of point in register R (`point-to-register').
  557. `C-x j R'
  558.      Jump to the location saved in register R (`register-to-point').
  559.    To save the current location of point in a register, choose a name R
  560. and type `C-x / R'.  The register R retains the location thus saved
  561. until you store something else in that register.
  562.    The command `C-x j R' moves point to the location recorded in
  563. register R.  The register is not affected; it continues to record the
  564. same location.  You can jump to the same position using the same
  565. register as often as you want.
  566. File: lemacs,  Node: RegText,  Next: RegRect,  Prev: RegPos,  Up: Registers
  567. Saving Text in Registers
  568. ========================
  569.    When you want to insert a copy of the same piece of text many times,
  570. it can be impractical to use the kill ring, since each subsequent kill
  571. moves the piece of text further down on the ring.  It becomes hard to
  572. keep track of the argument needed to retrieve the same text with `C-y'.
  573. An alternative is to store the text in a register with `C-x x'
  574. (`copy-to-register') and then retrieve it with `C-x g'
  575. (`insert-register').
  576. `C-x x R'
  577.      Copy region into register R (`copy-to-register').
  578. `C-x g R'
  579.      Insert text contents of register R (`insert-register').
  580.    `C-x x R' stores a copy of the text of the region into the register
  581. named R.  Given a numeric argument, `C-x x' deletes the text from the
  582. buffer as well.
  583.    `C-x g R' inserts the text from register R in the buffer.  By
  584. default it leaves point before the text and places the mark after it.
  585. With a numeric argument, it puts point after the text and the mark
  586. before it.
  587. File: lemacs,  Node: RegRect,  Prev: RegText,  Up: Registers
  588. Saving Rectangles in Registers
  589. ==============================
  590.    A register can contain a rectangle instead of lines of text.  The
  591. rectangle is represented as a list of strings.  *Note Rectangles::, for
  592. basic information on rectangles and how to specify rectangles in a
  593. buffer.
  594. `C-x r R'
  595.      Copy the region-rectangle into register
  596.      R(`copy-region-to-rectangle').  With a numeric argument, delete it
  597.      as well.
  598. `C-x g R'
  599.      Insert the rectangle stored in register R (if it contains a
  600.      rectangle) (`insert-register').
  601.    The `C-x g' command inserts linear text if the register contains
  602. that, or inserts a rectangle if the register contains one.
  603. File: lemacs,  Node: Display,  Next: Search,  Prev: Registers,  Up: Top
  604. Controlling the Display
  605. ***********************
  606.    Since only part of a large buffer fits in the window, Emacs tries to
  607. show the part that is likely to be interesting.  The display control
  608. commands allow you to specify which part of the text you want to see.
  609. `C-l'
  610.      Clear screen and redisplay, scrolling the selected window to center
  611.      point vertically within it (`recenter').
  612. `C-v'
  613.      Scroll forward (a windowful or a specified number of lines)
  614.      (`scroll-up').
  615. `M-v'
  616.      Scroll backward (`scroll-down').
  617. `ARG C-l'
  618.      Scroll so point is on line ARG (`recenter').
  619. `C-x <'
  620.      Scroll text in current window to the left (`scroll-left').
  621. `C-x >'
  622.      Scroll to the right (`scroll-right').
  623. `C-x $'
  624.      Make deeply indented lines invisible (`set-selective-display').
  625. * Menu:
  626. * Scrolling::               Moving text up and down in a window.
  627. * Horizontal Scrolling::   Moving text left and right in a window.
  628. * Selective Display::      Hiding lines with lots of indentation.
  629. * Display Vars::           Information on variables for customizing display.
  630. File: lemacs,  Node: Scrolling,  Next: Horizontal Scrolling,  Prev: Display,  Up: Display
  631. Scrolling
  632. =========
  633.    If a buffer contains text that is too large to fit entirely within
  634. the window that is displaying the buffer, Emacs shows a contiguous
  635. section of the text.  The section shown always contains point.
  636.    "Scrolling" means moving text up or down in the window so that
  637. different parts of the text are visible.  Scrolling forward means that
  638. text moves up, and new text appears at the bottom.  Scrolling backward
  639. moves text down and new text appears at the top.
  640.    Scrolling happens automatically if you move point past the bottom or
  641. top of the window.  You can also explicitly request scrolling with the
  642. commands in this section.
  643. `C-l'
  644.      Clear screen and redisplay, scrolling the selected window to center
  645.      point vertically within it (`recenter').
  646. `C-v'
  647.      Scroll forward (a windowful or a specified number of lines)
  648.      (`scroll-up').
  649. `M-v'
  650.      Scroll backward (`scroll-down').
  651. `ARG C-l'
  652.      Scroll so point is on line ARG (`recenter').
  653.    The most basic scrolling command is `C-l' (`recenter') with no
  654. argument.  It clears the entire screen and redisplays all windows.  In
  655. addition, it scrolls the selected window so that point is halfway down
  656. from the top of the window.
  657.    The scrolling commands `C-v' and `M-v' let you move all the text in
  658. the window up or down a few lines.  `C-v' (`scroll-up') with an
  659. argument shows you that many more lines at the bottom of the window,
  660. moving the text and point up together as `C-l' might.  `C-v' with a
  661. negative argument shows you more lines at the top of the window.
  662. `Meta-v' (`scroll-down') is like `C-v', but moves in the opposite
  663. direction.
  664.    To read the buffer a windowful at a time, use `C-v' with no
  665. argument.  `C-v' takes the last two lines at the bottom of the window
  666. and puts them at the top, followed by nearly a whole windowful of lines
  667. not previously visible.  Point moves to the new top of the window if it
  668. was in the text scrolled off the top.  `M-v' with no argument moves
  669. backward with similar overlap.  The number of lines of overlap across a
  670. `C-v' or `M-v' is controlled by the variable
  671. `next-screen-context-lines'; by default, it is two.
  672.    Another way to scroll is using `C-l' with a numeric argument.  `C-l'
  673. does not clear the screen when given an argument; it only scrolls the
  674. selected window.  With a positive argument N,`C-l' repositions text to
  675. put point N lines down from the top.  An argument of zero puts point on
  676. the very top line.  Point does not move with respect to the text;
  677. rather, the text and point move rigidly on the screen.  `C-l' with a
  678. negative argument puts point that many lines from the bottom of the
  679. window.  For example, `C-u - 1 C-l' puts point on the bottom line, and
  680. `C-u - 5 C-l' puts it five lines from the bottom.  Just `C-u' as
  681. argument, as in `C-u C-l', scrolls point to the center of the screen.
  682.    Scrolling happens automatically if point has moved out of the visible
  683. portion of the text when it is time to display.  Usually scrolling is
  684. done  to put point vertically centered within the window.  However, if
  685. the variable `scroll-step' has a non-zero value, an attempt is made to
  686. scroll the buffer by that many lines; if that is enough to bring point
  687. back into visibility, that is what happens.
  688. File: lemacs,  Node: Horizontal Scrolling,  Prev: Scrolling,  Up: Display
  689. Horizontal Scrolling
  690. ====================
  691. `C-x <'
  692.      Scroll text in current window to the left (`scroll-left').
  693. `C-x >'
  694.      Scroll to the right (`scroll-right').
  695.    The text in a window can also be scrolled horizontally.  This means
  696. that each line of text is shifted sideways in the window, and one or
  697. more characters at the beginning of each line are not displayed at all.
  698. When a window has been scrolled horizontally in this way, text lines
  699. are truncated rather than continued (*note Continuation Lines::.), with
  700. a `$' appearing in the first column when there is text truncated to the
  701. left, and in the last column when there is text truncated to the right.
  702.    The command `C-x <' (`scroll-left') scrolls the selected window to
  703. the left by N columns with argument N.  With no argument, it scrolls by
  704. almost the full width of the window (two columns less, to be precise).
  705. `C-x >' (`scroll-right') scrolls similarly to the right.  The window
  706. cannot be scrolled any farther to the right once it is displaying
  707. normally (with each line starting at the window's left margin);
  708. attempting to do so has no effect.
  709. File: lemacs,  Node: Selective Display,  Next: Display Vars,  Prev: Display,  Up: Display
  710. Selective Display
  711. =================
  712.    Emacs can hide lines indented more than a certain number of columns
  713. (you specify how many columns).  This allows you  to get an overview of
  714. a part of a program.
  715.    To hide lines, type `C-x $' (`set-selective-display') with a numeric
  716. argument N.  (*Note Arguments::, for information on giving the
  717. argument.)  Lines with at least N columns of indentation disappear from
  718. the screen.  The only indication of their presence are three dots
  719. (`...'), which appear at the end of each visible line that is followed
  720. by one or more invisible ones.
  721.    The invisible lines are still present in the buffer, and most editing
  722. commands see them as usual, so it is very easy to put point in the
  723. middle of invisible text.  When this happens, the cursor appears at the
  724. end of the previous line, after the three dots.  If point is at the end
  725. of the visible line, before the newline that ends it, the cursor
  726. appears before the three dots.
  727.    The commands `C-n' and `C-p' move across the invisible lines as if
  728. they were not there.
  729.    To make everything visible again, type `C-x $' with no argument.
  730. File: lemacs,  Node: Display Vars,  Prev: Selective Display,  Up: Display
  731. Variables Controlling Display
  732. =============================
  733.    This section contains information for customization only.  Beginning
  734. users should skip it.
  735.    The variable `mode-line-inverse-video' controls whether the mode
  736. line is displayed in inverse video (assuming the terminal supports it);
  737. `nil' means don't do so.  *Note Mode Line::.
  738.    If the variable `inverse-video' is non-`nil', Emacs attempts to
  739. invert all the lines of the display from what they normally are.
  740.    When you reenter Emacs after suspending, Emacs normally clears the
  741. screen and redraws the entire display.  On some terminals with more than
  742. one page of memory, it is possible to arrange the termcap entry so that
  743. the `ti' and `te' strings (output to the terminal when Emacs is entered
  744. and exited, respectively) switch between pages of memory so as to use
  745. one page for Emacs and another page for other output.  In that case,
  746. you might want to set the variable `no-redraw-on-reenter' non-`nil' so
  747. that Emacs will assume, when resumed, that the screen page it is using
  748. still contains what Emacs last wrote there.
  749.    The variable `echo-keystrokes' controls the echoing of
  750. multi-character keys; its value is the number of seconds of pause
  751. required to cause echoing to start, or zero meaning don't echo at all.
  752. *Note Echo Area::.
  753.    If the variable `ctl-arrow' is `nil', control characters in the
  754. buffer are displayed with octal escape sequences, all except newline and
  755. tab.  If its value is `t', then control characters will be printed with
  756. an uparrow, for example `^A'.
  757.    If its value is not `t' and not `nil', then characters whose code is
  758. greater than 160 (that is, the space character (32) with its high bit
  759. set) will be assumed to be printable, and will be displayed without
  760. alteration.  This is the default when running under X Windows, since
  761. Lucid Emacs assumes an ISO/8859-1 character set (also known as
  762. "Latin1").  The `ctl-arrow' variable may also be set to an integer, in
  763. which case all characters whose codes are greater than or equal to that
  764. value will be assumed to be printable.
  765.    Altering the value of `ctl-arrow' makes it local to the current
  766. buffer; until that time, the default value is in effect.  *Note
  767. Locals::.
  768.    Normally, a tab character in the buffer is displayed as whitespace
  769. which extends to the next display tab stop position, and display tab
  770. stops come at intervals equal to eight spaces.  The number of spaces
  771. per tab is controlled by the variable `tab-width', which is made local
  772. by changing it, just like `ctl-arrow'.  Note that how the tab character
  773. in the buffer is displayed has nothing to do with the definition of TAB
  774. as a command.
  775.    If you set the variable `selective-display-ellipses' to `nil', the
  776. three dots at the end of a line that precedes invisible lines do not
  777. appear.  There is no visible indication of the invisible lines.  This
  778. variable becomes local automatically when set.
  779. File: lemacs,  Node: Search,  Next: Fixit,  Prev: Display,  Up: Top
  780. Searching and Replacement
  781. *************************
  782.    Like other editors, Emacs has commands for searching for occurrences
  783. of a string.  The principal search command is unusual in that it is
  784. "incremental": it begins to search before you have finished typing the
  785. search string.  There are also non-incremental search commands more like
  786. those of other editors.
  787.    Besides the usual `replace-string' command that finds all
  788. occurrences of one string and replaces them with another, Emacs has a
  789. fancy replacement command called `query-replace' which asks
  790. interactively which occurrences to replace.
  791. * Menu:
  792. * Incremental Search::     Search happens as you type the string.
  793. * Non-Incremental Search::  Specify entire string and then search.
  794. * Word Search::            Search for sequence of words.
  795. * Regexp Search::          Search for match for a regexp.
  796. * Regexps::                Syntax of regular expressions.
  797. * Search Case::            To ignore case while searching, or not.
  798. * Replace::                Search, and replace some or all matches.
  799. * Other Repeating Search:: Operating on all matches for some regexp.
  800.